# coding:utf-8


class EncodingDemo:
    def _test_origin(self):
        """
        ed = EncodingDemo()
        ed._test_origin()
        """
        data = 'sh_python2'
        print(type(data))
        print(data)

        data = '上海_python2'
        print(type(data))
        print(data)

    def _test_encoding(self):
        """
        ed = EncodingDemo()
        ed._test_encoding()
        """
        data = 'sh_python2'
        b_data = data.encode()
        print(type(b_data))
        print(b_data)

        data = '上海_python2'
        b_data = data.encode()
        print(type(b_data))
        print(b_data)

    def _test_decoding(self):
        """
        ed = EncodingDemo()
        ed._test_decoding()
        """
        data = 'sh_python2'
        b_data = data.encode()
        s_data = b_data.decode('utf-8')
        print(type(s_data))
        print(s_data)

        data = '上海_python2'
        b_data = data.encode()
        s_data = b_data.decode('utf-8')
        print(type(s_data))
        print(s_data)


if __name__ == '__main__':
    ed = EncodingDemo()
    ed._test_decoding()
